<?php
	add_action('wp_footer', 'bt_create_google_analytics');
	function bt_create_google_analytics(){
      $google_analytics =get_option('google_analytics');
      if($google_analytics)
      {

        echo '<script type="text/javascript">';
        echo 'var _gaq = _gaq || [];';
        echo "_gaq.push(['_setAccount', '";
        echo $google_analytics ."']);";
        echo "_gaq.push(['_trackPageview']);";
        echo "(function() {";
        echo "var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;";
        echo "ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';";
        echo "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);";
        echo "})();";
        echo "</script>";

      }
	}

